const curEnv = process.env.NODE_ENV === 'production' ? 'https://vue.learnerhub.net' : '';

export default {
  plugins: 'lists table image imagetools quickbars  paste autolink link codesample searchreplace charmap hr emoticons anchor',
  toolbar: [
    { name: 'styles', items: ['styleselect'] },
    { name: 'formatting', items: ['bold', 'italic'] },
    { name: 'color', items: ['forecolor', 'backcolor'] },
    { name: 'alignment', items: ['alignleft', 'aligncenter', 'alignright', 'alignjustify'] },
    { name: 'lists', items: ['numlist', 'bullist'] },
    { name: 'indentation', items: ['outdent', 'indent'] },
    { name: 'insert', items: ['link', 'codesample', 'quickimage', 'table'] },
    { name: 'clear', items: ['removeformat'] },
    { name: 'history', items: ['undo', 'redo'] },
  ],
  otherConfigs: {
    imagetools_cors_hosts: ['mydomain.com', 'otherdomain.com'],
    imagetools_proxy: ' ',
    imagetools_toolbar: 'rotateleft rotateright | flipv fliph | editimage',
    language_url: `${curEnv}/static/tinymce/langs/zh_CN.js`,
    language: 'zh_CN',
    skin_url: `${curEnv}/static/tinymce/skins/ui/oxide`,
    content_css: `${curEnv}/static/tinymce/skins/content/default/content.css`,
    icons_url: `${curEnv}/static/tinymce/icons/icons.js`,
    emoticons_database_url: `${curEnv}/static/tinymce/emoticons/emojis.min.js`,
    content_style: 'body { font-size: 15px; }',
    branding: false, // 禁用“Powered by TinyMCE”
    elementpath: false, // 隐藏底部元素路径
    menu: {
      edit: { title: '编辑', items: 'searchreplace' },
      format: { title: '格式', items: 'bold italic underline strikethrough superscript subscript | fontsizes | removeformat' },
    },
    menubar: 'edit insert format tools',
    paste_data_images: true,
    style_formats: [
      { title: '段落', block: 'p' },
      { title: '标题1', block: 'h1' },
      { title: '标题2', block: 'h2' },
      { title: '标题3', block: 'h3' },
      { title: '标题4', block: 'h4' },
      { title: '标题5', block: 'h5' },
      { title: '标题6', block: 'h6' },
    ],
  },
};
